package com.ruoyi.system.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.ruoyi.system.domain.Warehousing;
import com.ruoyi.system.mapper.PurchaseMapper;
import com.ruoyi.system.mapper.WarehousingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OutingMapper;
import com.ruoyi.system.domain.Outing;
import com.ruoyi.system.service.IOutingService;

/**
 * 出库单Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-05-08
 */
@Service
public class OutingServiceImpl implements IOutingService 
{
    @Autowired
    private OutingMapper outingMapper;

    /**
     * 查询出库单
     * 
     * @param id 出库单ID
     * @return 出库单
     */
    @Override
    public Outing selectOutingById(Integer id)
    {
        return outingMapper.selectOutingById(id);
    }

    /**
     * 查询出库单列表
     * 
     * @param outing 出库单
     * @return 出库单
     */
    @Override
    public List<Outing> selectOutingList(Outing outing)
    {
        return outingMapper.selectOutingList(outing);
    }

    /**
     * 新增出库单
     * 
     * @param outing 出库单
     * @return 结果
     */
    @Override
    public int insertOuting(Outing outing)
    {
        return outingMapper.insertOuting(outing);
    }

    /**
     * 修改出库单
     * 
     * @param outing 出库单
     * @return 结果
     */
    @Override
    public int updateOuting(Outing outing)
    {
        return outingMapper.updateOuting(outing);
    }

    /**
     * 批量删除出库单
     * 
     * @param ids 需要删除的出库单ID
     * @return 结果
     */
    @Override
    public int deleteOutingByIds(Integer[] ids)
    {
        return outingMapper.deleteOutingByIds(ids);
    }

    /**
     * 删除出库单信息
     * 
     * @param id 出库单ID
     * @return 结果
     */
    @Override
    public int deleteOutingById(Integer id)
    {
        return outingMapper.deleteOutingById(id);
    }

    @Override
    public List<Outing> QueryOuting(Outing outing) {
        ArrayList<Outing> out = new ArrayList<>();
        List<Outing> outings = outingMapper.QueryOuting(outing);
        List<Outing> outings1 = outingMapper.selectOuting(outing);
        for (int i = 0; i < outings.size(); i++) {
            out.add(outings.get(i));
        }
        for (int i = 0; i < outings1.size(); i++) {
            out.add(outings1.get(i));
        }
        return out;
    }
}
